using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace UwinEducation.Domain.Entities
{

    /// <summary>
    /// 用户角色关联实体
    /// </summary>
    [Table("sys_user_roles")]
    public class UserRole : EntityBase
    {
        /// <summary>
        /// 用户角色ID
        /// </summary>
        public Guid Id { get; private set; }

        /// <summary>
        /// 用户ID
        /// </summary>
        public Guid UserId { get; private set; }

        /// <summary>
        /// 角色ID
        /// </summary>
        public Guid RoleId { get; private set; }

        /// <summary>
        /// 用户导航属性
        /// </summary>
        //public User User { get; private set; }

        /// <summary>
        /// 角色导航属性
        /// </summary>
        //public Role Role { get; private set; }

        private UserRole() { }

        /// <summary>
        /// 创建用户角色关联
        /// </summary>
        /// <param name="userId">用户ID</param>
        /// <param name="roleId">角色ID</param>
        /// <returns>用户角色关联实体</returns>
        public static UserRole Create(Guid userId, Guid roleId)
        {
            return new UserRole
            {
                Id = Guid.NewGuid(),
                UserId = userId,
                RoleId = roleId
            };
        }
    }
}